package com.dcits.dubbo.scheduled;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dcits.api.ApiService;
import com.dcits.api.entity.ApiInfo;
import com.dcits.dubbo.Controller.ApiInfoController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class SendMessageTask {
    private static Logger log = LoggerFactory.getLogger(ApiInfoController.class);

    @Reference(version = "1.0.0",timeout = 3000)
    private ApiService apiservice;
    /*
     * 定时任务 类作为组件@Component交给spring容器管理
     * @Scheduled ：设置定时任务
     * cron：设置定时任务触发时间
     */
    @Scheduled(cron="0/1 * * * * ?")
    public void task() {
        //System.out.println(LocalDateTime.now()+" 我是scheduler任务，10秒执行 一次");
        ApiInfo info = new ApiInfo();

        info.setApiId("查询个人信息");

        apiservice.GetApiInfo(info);
    }
}